#!/bin/sh

>tmp$$
cat CompositeStocks |sort |uniq |while read stock
do
    rating=`curl -stderr "http://www.tradestars.com/grail-indicator.asp?symbol=$stock" |grep "*FREE SIGNALS" |sed 's/<br>/\n/g' |head -n 5 |egrep "NO Signal|go SHORT|go LONG" |sed 's/<\/b>//g'`
    echo $stock,$rating >> tmp$$
done

cat tmp$$ |grep "go LONG" |cut -d',' -f1 > TraderStarLongList
cat tmp$$ |grep "go SHORT"|cut -d',' -f1 > TraderStarShortList
